{
 "cells": [
  {
   "cell_type": "markdown",
   "source": [
    "# power_sjj2008数据源 贴源数据层 代码实现"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%% md\n"
    }
   }
  },
  {
   "cell_type": "markdown",
   "source": [
    "## 1. 数据准备工作\n",
    "导入ods_jvm2008，调用其中的下载函数和读取函数。"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%% md\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 109,
   "outputs": [
    {
     "data": {
      "text/plain": "         Benchmark  Benchmark Version      Hardware Vendor\\t  \\\n0    power_ssj2008                1.1  ASUSTeK Computer Inc.   \n1    power_ssj2008                1.1  ASUSTeK Computer Inc.   \n2    power_ssj2008                1.1  ASUSTeK Computer Inc.   \n3    power_ssj2008                1.2  ASUSTeK Computer Inc.   \n4    power_ssj2008                1.2  ASUSTeK Computer Inc.   \n..             ...                ...                    ...   \n814  power_ssj2008                1.2                  XSLAB   \n815  power_ssj2008                1.2             ZT Systems   \n816  power_ssj2008                1.2             ZT Systems   \n817  power_ssj2008                1.2             ZT Systems   \n818  power_ssj2008                1.2             ZT Systems   \n\n                                                System  Nodes\\t Form Factor\\t  \\\n0    ASUS RS100-E5 (Intel Xeon X3360 Processor, 2.8...        1            --   \n1    ASUS RS160-E5 (Intel Xeon L5420 Processor, 2.5...        1            --   \n2    ASUS RS160-E5 (Intel Xeon L5430 Processor, 2.6...        1            --   \n3                                       RS500A-E10-PS4        1            1U   \n4                                       RS500A-E10-PS4        1            1U   \n..                                                 ...      ...           ...   \n814                                        V-Raptor SQ       16            2U   \n815                           1224Ra Datacenter Server        1            1U   \n816                           1224Ra Datacenter Server        1            1U   \n817                           1224Ra Datacenter Server        1            1U   \n818                           1253Ra Datacenter Server        1            1U   \n\n    Test Method\\t   Result  ssj_ops @ 100% of target load\\t  \\\n0     Single Node    905.0                         165064.0   \n1     Single Node   1009.0                         270621.0   \n2     Single Node   1020.0                         278927.0   \n3     Single Node  20908.0                        6064780.0   \n4     Single Node  21168.0                        5879510.0   \n..            ...      ...                              ...   \n814    Multi Node   3337.0                        1577510.0   \n815   Single Node   1379.0                         342104.0   \n816   Single Node   1614.0                         406954.0   \n817   Single Node   1532.0                         462215.0   \n818   Single Node   2106.0                         409496.0   \n\n     ssj_ops @ 90% of target load\\t  ...  SW Avail  License  \\\n0                          149393.0  ...  Mar-2008     9016   \n1                          243781.0  ...  Sep-2008     9016   \n2                          252327.0  ...  Sep-2008     9016   \n3                         5468830.0  ...  Aug-2019     9016   \n4                         5309380.0  ...  Dec-2018     9016   \n..                              ...  ...       ...      ...   \n814                       1444900.0  ...  Sep-2018       83   \n815                        306578.0  ...  Dec-2008       49   \n816                        368764.0  ...  Aug-2009       49   \n817                        415843.0  ...  Aug-2009       49   \n818                        369474.0  ...  Aug-2009       49   \n\n                                     Tested By  \\\n0                         ASUSTeK Company Inc.   \n1                         ASUSTeK Company Inc.   \n2                         ASUSTeK Company Inc.   \n3                        ASUSTeK Computer Inc.   \n4                        ASUSTeK Computer Inc.   \n..                                         ...   \n814  Telecommunications Technology Association   \n815                     Advanced Micro Devices   \n816                     Advanced Micro Devices   \n817                     Advanced Micro Devices   \n818                     Advanced Micro Devices   \n\n                                  Test Sponsor  Test Date  Published  \\\n0                         ASUSTeK Company Inc.   Dec-2008   Jan-2009   \n1                         ASUSTeK Company Inc.   Oct-2008   Nov-2008   \n2                         ASUSTeK Company Inc.   Oct-2008   Nov-2008   \n3                        ASUSTeK Computer Inc.   Nov-2019   Jan-2020   \n4                        ASUSTeK Computer Inc.   Nov-2019   Jan-2020   \n..                                         ...        ...        ...   \n814  Telecommunications Technology Association   Sep-2021   Dec-2021   \n815                                 ZT Systems   Apr-2009   May-2009   \n816                     Advanced Micro Devices   Aug-2009   Aug-2009   \n817                     Advanced Micro Devices   Aug-2009   Aug-2009   \n818                                 ZT Systems   May-2010   Jun-2010   \n\n     Updated                                          Disclosure  \\\n0    Jul-2010  http://www.spec.org/power_ssj2008/results/res2...   \n1    Apr-2009  http://www.spec.org/power_ssj2008/results/res2...   \n2    Apr-2009  http://www.spec.org/power_ssj2008/results/res2...   \n3    Jan-2020  http://www.spec.org/power_ssj2008/results/res2...   \n4    Jan-2020  http://www.spec.org/power_ssj2008/results/res2...   \n..        ...                                                ...   \n814  Dec-2021  http://www.spec.org/power_ssj2008/results/res2...   \n815  Jul-2010  http://www.spec.org/power_ssj2008/results/res2...   \n816  Aug-2009  http://www.spec.org/power_ssj2008/results/res2...   \n817  Aug-2009  http://www.spec.org/power_ssj2008/results/res2...   \n818  Jul-2010  http://www.spec.org/power_ssj2008/results/res2...   \n\n     Disclosure URL  Disclosures  \n0               NaN          NaN  \n1               NaN          NaN  \n2               NaN          NaN  \n3               NaN          NaN  \n4               NaN          NaN  \n..              ...          ...  \n814             NaN          NaN  \n815             NaN          NaN  \n816             NaN          NaN  \n817             NaN          NaN  \n818             NaN          NaN  \n\n[819 rows x 90 columns]",
      "text/html": "<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n\n    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n\n    .dataframe thead th {\n        text-align: right;\n    }\n</style>\n<table border=\"1\" class=\"dataframe\">\n  <thead>\n    <tr style=\"text-align: right;\">\n      <th></th>\n      <th>Benchmark</th>\n      <th>Benchmark Version</th>\n      <th>Hardware Vendor\\t</th>\n      <th>System</th>\n      <th>Nodes\\t</th>\n      <th>Form Factor\\t</th>\n      <th>Test Method\\t</th>\n      <th>Result</th>\n      <th>ssj_ops @ 100% of target load\\t</th>\n      <th>ssj_ops @ 90% of target load\\t</th>\n      <th>...</th>\n      <th>SW Avail</th>\n      <th>License</th>\n      <th>Tested By</th>\n      <th>Test Sponsor</th>\n      <th>Test Date</th>\n      <th>Published</th>\n      <th>Updated</th>\n      <th>Disclosure</th>\n      <th>Disclosure URL</th>\n      <th>Disclosures</th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <th>0</th>\n      <td>power_ssj2008</td>\n      <td>1.1</td>\n      <td>ASUSTeK Computer Inc.</td>\n      <td>ASUS RS100-E5 (Intel Xeon X3360 Processor, 2.8...</td>\n      <td>1</td>\n      <td>--</td>\n      <td>Single Node</td>\n      <td>905.0</td>\n      <td>165064.0</td>\n      <td>149393.0</td>\n      <td>...</td>\n      <td>Mar-2008</td>\n      <td>9016</td>\n      <td>ASUSTeK Company Inc.</td>\n      <td>ASUSTeK Company Inc.</td>\n      <td>Dec-2008</td>\n      <td>Jan-2009</td>\n      <td>Jul-2010</td>\n      <td>http://www.spec.org/power_ssj2008/results/res2...</td>\n      <td>NaN</td>\n      <td>NaN</td>\n    </tr>\n    <tr>\n      <th>1</th>\n      <td>power_ssj2008</td>\n      <td>1.1</td>\n      <td>ASUSTeK Computer Inc.</td>\n      <td>ASUS RS160-E5 (Intel Xeon L5420 Processor, 2.5...</td>\n      <td>1</td>\n      <td>--</td>\n      <td>Single Node</td>\n      <td>1009.0</td>\n      <td>270621.0</td>\n      <td>243781.0</td>\n      <td>...</td>\n      <td>Sep-2008</td>\n      <td>9016</td>\n      <td>ASUSTeK Company Inc.</td>\n      <td>ASUSTeK Company Inc.</td>\n      <td>Oct-2008</td>\n      <td>Nov-2008</td>\n      <td>Apr-2009</td>\n      <td>http://www.spec.org/power_ssj2008/results/res2...</td>\n      <td>NaN</td>\n      <td>NaN</td>\n    </tr>\n    <tr>\n      <th>2</th>\n      <td>power_ssj2008</td>\n      <td>1.1</td>\n      <td>ASUSTeK Computer Inc.</td>\n      <td>ASUS RS160-E5 (Intel Xeon L5430 Processor, 2.6...</td>\n      <td>1</td>\n      <td>--</td>\n      <td>Single Node</td>\n      <td>1020.0</td>\n      <td>278927.0</td>\n      <td>252327.0</td>\n      <td>...</td>\n      <td>Sep-2008</td>\n      <td>9016</td>\n      <td>ASUSTeK Company Inc.</td>\n      <td>ASUSTeK Company Inc.</td>\n      <td>Oct-2008</td>\n      <td>Nov-2008</td>\n      <td>Apr-2009</td>\n      <td>http://www.spec.org/power_ssj2008/results/res2...</td>\n      <td>NaN</td>\n      <td>NaN</td>\n    </tr>\n    <tr>\n      <th>3</th>\n      <td>power_ssj2008</td>\n      <td>1.2</td>\n      <td>ASUSTeK Computer Inc.</td>\n      <td>RS500A-E10-PS4</td>\n      <td>1</td>\n      <td>1U</td>\n      <td>Single Node</td>\n      <td>20908.0</td>\n      <td>6064780.0</td>\n      <td>5468830.0</td>\n      <td>...</td>\n      <td>Aug-2019</td>\n      <td>9016</td>\n      <td>ASUSTeK Computer Inc.</td>\n      <td>ASUSTeK Computer Inc.</td>\n      <td>Nov-2019</td>\n      <td>Jan-2020</td>\n      <td>Jan-2020</td>\n      <td>http://www.spec.org/power_ssj2008/results/res2...</td>\n      <td>NaN</td>\n      <td>NaN</td>\n    </tr>\n    <tr>\n      <th>4</th>\n      <td>power_ssj2008</td>\n      <td>1.2</td>\n      <td>ASUSTeK Computer Inc.</td>\n      <td>RS500A-E10-PS4</td>\n      <td>1</td>\n      <td>1U</td>\n      <td>Single Node</td>\n      <td>21168.0</td>\n      <td>5879510.0</td>\n      <td>5309380.0</td>\n      <td>...</td>\n      <td>Dec-2018</td>\n      <td>9016</td>\n      <td>ASUSTeK Computer Inc.</td>\n      <td>ASUSTeK Computer Inc.</td>\n      <td>Nov-2019</td>\n      <td>Jan-2020</td>\n      <td>Jan-2020</td>\n      <td>http://www.spec.org/power_ssj2008/results/res2...</td>\n      <td>NaN</td>\n      <td>NaN</td>\n    </tr>\n    <tr>\n      <th>...</th>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n    </tr>\n    <tr>\n      <th>814</th>\n      <td>power_ssj2008</td>\n      <td>1.2</td>\n      <td>XSLAB</td>\n      <td>V-Raptor SQ</td>\n      <td>16</td>\n      <td>2U</td>\n      <td>Multi Node</td>\n      <td>3337.0</td>\n      <td>1577510.0</td>\n      <td>1444900.0</td>\n      <td>...</td>\n      <td>Sep-2018</td>\n      <td>83</td>\n      <td>Telecommunications Technology Association</td>\n      <td>Telecommunications Technology Association</td>\n      <td>Sep-2021</td>\n      <td>Dec-2021</td>\n      <td>Dec-2021</td>\n      <td>http://www.spec.org/power_ssj2008/results/res2...</td>\n      <td>NaN</td>\n      <td>NaN</td>\n    </tr>\n    <tr>\n      <th>815</th>\n      <td>power_ssj2008</td>\n      <td>1.2</td>\n      <td>ZT Systems</td>\n      <td>1224Ra Datacenter Server</td>\n      <td>1</td>\n      <td>1U</td>\n      <td>Single Node</td>\n      <td>1379.0</td>\n      <td>342104.0</td>\n      <td>306578.0</td>\n      <td>...</td>\n      <td>Dec-2008</td>\n      <td>49</td>\n      <td>Advanced Micro Devices</td>\n      <td>ZT Systems</td>\n      <td>Apr-2009</td>\n      <td>May-2009</td>\n      <td>Jul-2010</td>\n      <td>http://www.spec.org/power_ssj2008/results/res2...</td>\n      <td>NaN</td>\n      <td>NaN</td>\n    </tr>\n    <tr>\n      <th>816</th>\n      <td>power_ssj2008</td>\n      <td>1.2</td>\n      <td>ZT Systems</td>\n      <td>1224Ra Datacenter Server</td>\n      <td>1</td>\n      <td>1U</td>\n      <td>Single Node</td>\n      <td>1614.0</td>\n      <td>406954.0</td>\n      <td>368764.0</td>\n      <td>...</td>\n      <td>Aug-2009</td>\n      <td>49</td>\n      <td>Advanced Micro Devices</td>\n      <td>Advanced Micro Devices</td>\n      <td>Aug-2009</td>\n      <td>Aug-2009</td>\n      <td>Aug-2009</td>\n      <td>http://www.spec.org/power_ssj2008/results/res2...</td>\n      <td>NaN</td>\n      <td>NaN</td>\n    </tr>\n    <tr>\n      <th>817</th>\n      <td>power_ssj2008</td>\n      <td>1.2</td>\n      <td>ZT Systems</td>\n      <td>1224Ra Datacenter Server</td>\n      <td>1</td>\n      <td>1U</td>\n      <td>Single Node</td>\n      <td>1532.0</td>\n      <td>462215.0</td>\n      <td>415843.0</td>\n      <td>...</td>\n      <td>Aug-2009</td>\n      <td>49</td>\n      <td>Advanced Micro Devices</td>\n      <td>Advanced Micro Devices</td>\n      <td>Aug-2009</td>\n      <td>Aug-2009</td>\n      <td>Aug-2009</td>\n      <td>http://www.spec.org/power_ssj2008/results/res2...</td>\n      <td>NaN</td>\n      <td>NaN</td>\n    </tr>\n    <tr>\n      <th>818</th>\n      <td>power_ssj2008</td>\n      <td>1.2</td>\n      <td>ZT Systems</td>\n      <td>1253Ra Datacenter Server</td>\n      <td>1</td>\n      <td>1U</td>\n      <td>Single Node</td>\n      <td>2106.0</td>\n      <td>409496.0</td>\n      <td>369474.0</td>\n      <td>...</td>\n      <td>Aug-2009</td>\n      <td>49</td>\n      <td>Advanced Micro Devices</td>\n      <td>ZT Systems</td>\n      <td>May-2010</td>\n      <td>Jun-2010</td>\n      <td>Jul-2010</td>\n      <td>http://www.spec.org/power_ssj2008/results/res2...</td>\n      <td>NaN</td>\n      <td>NaN</td>\n    </tr>\n  </tbody>\n</table>\n<p>819 rows × 90 columns</p>\n</div>"
     },
     "execution_count": 109,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from ods import ods\n",
    "import pandas as pd\n",
    "#\n",
    "#ods_jvm2008.download_latest_results(\"power_ssj2008\")\n",
    "power_ssj = pd.read_csv(ods_jvm2008.get_latest_results(benchmark_name=\"power_ssj2008\"))\n",
    "power_ssj"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 110,
   "outputs": [
    {
     "data": {
      "text/plain": "           Hardware Vendor                                             System  \\\n0    ASUSTeK Computer Inc.  ASUS RS100-E5 (Intel Xeon X3360 Processor, 2.8...   \n1    ASUSTeK Computer Inc.  ASUS RS160-E5 (Intel Xeon L5420 Processor, 2.5...   \n2    ASUSTeK Computer Inc.  ASUS RS160-E5 (Intel Xeon L5430 Processor, 2.6...   \n3    ASUSTeK Computer Inc.                                     RS500A-E10-PS4   \n4    ASUSTeK Computer Inc.                                     RS500A-E10-PS4   \n..                     ...                                                ...   \n814                  XSLAB                                        V-Raptor SQ   \n815             ZT Systems                           1224Ra Datacenter Server   \n816             ZT Systems                           1224Ra Datacenter Server   \n817             ZT Systems                           1224Ra Datacenter Server   \n818             ZT Systems                           1253Ra Datacenter Server   \n\n      Result  # Cores  # Cores Per Chip  \\\n0      905.0        4                 4   \n1     1009.0        8                 4   \n2     1020.0        8                 4   \n3    20908.0       64                64   \n4    21168.0       64                64   \n..       ...      ...               ...   \n814   3337.0      384                 1   \n815   1379.0        8                 4   \n816   1614.0       12                 6   \n817   1532.0       12                 6   \n818   2106.0       12                 6   \n\n                                             Processor  Processor MHz  \\\n0                           Intel Xeon X3360 Processor           2833   \n1                                     Intel Xeon L5420           2500   \n2                                     Intel Xeon L5430           2666   \n3                                AMD EPYC 7742 2.25Ghz           2250   \n4                                AMD EPYC 7742 2.25Ghz           2250   \n..                                                 ...            ...   \n814  ARM Cortex A53(1GHz) 24 Cores: SOCIONEXT SC2A1...           1000   \n815                                AMD Opteron 2377 EE           2300   \n816                                AMD Opteron 2419 EE           1800   \n817                                AMD Opteron 2425 HE           2100   \n818                                AMD Opteron 4164 EE           1800   \n\n                        1st Level Cache  \\\n0    32 KB I + 32 KB D on chip per core   \n1    32 KB I + 32 KB D on chip per core   \n2    32 KB I + 32 KB D on chip per core   \n3    32 KB I + 32 KB D on chip per core   \n4    32 KB I + 32 KB D on chip per core   \n..                                  ...   \n814  16 KB I + 16 KB D on chip per core   \n815  64 KB I + 64 KB D on chip per core   \n816  64 KB I + 64 KB D on chip per core   \n817  64 KB I + 64 KB D on chip per core   \n818  64 KB I + 64 KB D on chip per core   \n\n                                       2nd Level Cache  \\\n0    12 MB I+D on chip per chip, 6 MB shared / 2 cores   \n1    12 MB I+D on chip per chip, 6 MB shared / 2 cores   \n2    12 MB I+D on chip per chip, 6 MB shared / 2 cores   \n3                          512 KB I+D on chip per core   \n4                          512 KB I+D on chip per core   \n..                                                 ...   \n814                   256 KB I+D on chip per dual core   \n815                        512 KB I+D on chip per core   \n816                        512 KB I+D on chip per core   \n817                        512 KB I+D on chip per core   \n818                        512 KB I+D on chip per core   \n\n                                       3rd Level Cache Memory (GB)   Updated  \\\n0                                                 None        4.00  Jul-2010   \n1                                                 None        8.00  Apr-2009   \n2                                                 None        8.00  Apr-2009   \n3    256 MB I+D on chip per chip, 16 MB shared / 4 ...         128  Jan-2020   \n4    256 MB I+D on chip per chip, 16 MB shared / 4 ...         128  Jan-2020   \n..                                                 ...         ...       ...   \n814                          4 MB I+D on chip per chip         256  Dec-2021   \n815                          6 MB I+D on chip per chip        16.0  Jul-2010   \n816                          6 MB I+D on chip per chip        8.00  Aug-2009   \n817                          6 MB I+D on chip per chip        16.0  Aug-2009   \n818                          6 MB I+D on chip per chip        16.0  Jul-2010   \n\n                                            Disclosure  \n0    http://www.spec.org/power_ssj2008/results/res2...  \n1    http://www.spec.org/power_ssj2008/results/res2...  \n2    http://www.spec.org/power_ssj2008/results/res2...  \n3    http://www.spec.org/power_ssj2008/results/res2...  \n4    http://www.spec.org/power_ssj2008/results/res2...  \n..                                                 ...  \n814  http://www.spec.org/power_ssj2008/results/res2...  \n815  http://www.spec.org/power_ssj2008/results/res2...  \n816  http://www.spec.org/power_ssj2008/results/res2...  \n817  http://www.spec.org/power_ssj2008/results/res2...  \n818  http://www.spec.org/power_ssj2008/results/res2...  \n\n[819 rows x 13 columns]",
      "text/html": "<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n\n    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n\n    .dataframe thead th {\n        text-align: right;\n    }\n</style>\n<table border=\"1\" class=\"dataframe\">\n  <thead>\n    <tr style=\"text-align: right;\">\n      <th></th>\n      <th>Hardware Vendor</th>\n      <th>System</th>\n      <th>Result</th>\n      <th># Cores</th>\n      <th># Cores Per Chip</th>\n      <th>Processor</th>\n      <th>Processor MHz</th>\n      <th>1st Level Cache</th>\n      <th>2nd Level Cache</th>\n      <th>3rd Level Cache</th>\n      <th>Memory (GB)</th>\n      <th>Updated</th>\n      <th>Disclosure</th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <th>0</th>\n      <td>ASUSTeK Computer Inc.</td>\n      <td>ASUS RS100-E5 (Intel Xeon X3360 Processor, 2.8...</td>\n      <td>905.0</td>\n      <td>4</td>\n      <td>4</td>\n      <td>Intel Xeon X3360 Processor</td>\n      <td>2833</td>\n      <td>32 KB I + 32 KB D on chip per core</td>\n      <td>12 MB I+D on chip per chip, 6 MB shared / 2 cores</td>\n      <td>None</td>\n      <td>4.00</td>\n      <td>Jul-2010</td>\n      <td>http://www.spec.org/power_ssj2008/results/res2...</td>\n    </tr>\n    <tr>\n      <th>1</th>\n      <td>ASUSTeK Computer Inc.</td>\n      <td>ASUS RS160-E5 (Intel Xeon L5420 Processor, 2.5...</td>\n      <td>1009.0</td>\n      <td>8</td>\n      <td>4</td>\n      <td>Intel Xeon L5420</td>\n      <td>2500</td>\n      <td>32 KB I + 32 KB D on chip per core</td>\n      <td>12 MB I+D on chip per chip, 6 MB shared / 2 cores</td>\n      <td>None</td>\n      <td>8.00</td>\n      <td>Apr-2009</td>\n      <td>http://www.spec.org/power_ssj2008/results/res2...</td>\n    </tr>\n    <tr>\n      <th>2</th>\n      <td>ASUSTeK Computer Inc.</td>\n      <td>ASUS RS160-E5 (Intel Xeon L5430 Processor, 2.6...</td>\n      <td>1020.0</td>\n      <td>8</td>\n      <td>4</td>\n      <td>Intel Xeon L5430</td>\n      <td>2666</td>\n      <td>32 KB I + 32 KB D on chip per core</td>\n      <td>12 MB I+D on chip per chip, 6 MB shared / 2 cores</td>\n      <td>None</td>\n      <td>8.00</td>\n      <td>Apr-2009</td>\n      <td>http://www.spec.org/power_ssj2008/results/res2...</td>\n    </tr>\n    <tr>\n      <th>3</th>\n      <td>ASUSTeK Computer Inc.</td>\n      <td>RS500A-E10-PS4</td>\n      <td>20908.0</td>\n      <td>64</td>\n      <td>64</td>\n      <td>AMD EPYC 7742 2.25Ghz</td>\n      <td>2250</td>\n      <td>32 KB I + 32 KB D on chip per core</td>\n      <td>512 KB I+D on chip per core</td>\n      <td>256 MB I+D on chip per chip, 16 MB shared / 4 ...</td>\n      <td>128</td>\n      <td>Jan-2020</td>\n      <td>http://www.spec.org/power_ssj2008/results/res2...</td>\n    </tr>\n    <tr>\n      <th>4</th>\n      <td>ASUSTeK Computer Inc.</td>\n      <td>RS500A-E10-PS4</td>\n      <td>21168.0</td>\n      <td>64</td>\n      <td>64</td>\n      <td>AMD EPYC 7742 2.25Ghz</td>\n      <td>2250</td>\n      <td>32 KB I + 32 KB D on chip per core</td>\n      <td>512 KB I+D on chip per core</td>\n      <td>256 MB I+D on chip per chip, 16 MB shared / 4 ...</td>\n      <td>128</td>\n      <td>Jan-2020</td>\n      <td>http://www.spec.org/power_ssj2008/results/res2...</td>\n    </tr>\n    <tr>\n      <th>...</th>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n    </tr>\n    <tr>\n      <th>814</th>\n      <td>XSLAB</td>\n      <td>V-Raptor SQ</td>\n      <td>3337.0</td>\n      <td>384</td>\n      <td>1</td>\n      <td>ARM Cortex A53(1GHz) 24 Cores: SOCIONEXT SC2A1...</td>\n      <td>1000</td>\n      <td>16 KB I + 16 KB D on chip per core</td>\n      <td>256 KB I+D on chip per dual core</td>\n      <td>4 MB I+D on chip per chip</td>\n      <td>256</td>\n      <td>Dec-2021</td>\n      <td>http://www.spec.org/power_ssj2008/results/res2...</td>\n    </tr>\n    <tr>\n      <th>815</th>\n      <td>ZT Systems</td>\n      <td>1224Ra Datacenter Server</td>\n      <td>1379.0</td>\n      <td>8</td>\n      <td>4</td>\n      <td>AMD Opteron 2377 EE</td>\n      <td>2300</td>\n      <td>64 KB I + 64 KB D on chip per core</td>\n      <td>512 KB I+D on chip per core</td>\n      <td>6 MB I+D on chip per chip</td>\n      <td>16.0</td>\n      <td>Jul-2010</td>\n      <td>http://www.spec.org/power_ssj2008/results/res2...</td>\n    </tr>\n    <tr>\n      <th>816</th>\n      <td>ZT Systems</td>\n      <td>1224Ra Datacenter Server</td>\n      <td>1614.0</td>\n      <td>12</td>\n      <td>6</td>\n      <td>AMD Opteron 2419 EE</td>\n      <td>1800</td>\n      <td>64 KB I + 64 KB D on chip per core</td>\n      <td>512 KB I+D on chip per core</td>\n      <td>6 MB I+D on chip per chip</td>\n      <td>8.00</td>\n      <td>Aug-2009</td>\n      <td>http://www.spec.org/power_ssj2008/results/res2...</td>\n    </tr>\n    <tr>\n      <th>817</th>\n      <td>ZT Systems</td>\n      <td>1224Ra Datacenter Server</td>\n      <td>1532.0</td>\n      <td>12</td>\n      <td>6</td>\n      <td>AMD Opteron 2425 HE</td>\n      <td>2100</td>\n      <td>64 KB I + 64 KB D on chip per core</td>\n      <td>512 KB I+D on chip per core</td>\n      <td>6 MB I+D on chip per chip</td>\n      <td>16.0</td>\n      <td>Aug-2009</td>\n      <td>http://www.spec.org/power_ssj2008/results/res2...</td>\n    </tr>\n    <tr>\n      <th>818</th>\n      <td>ZT Systems</td>\n      <td>1253Ra Datacenter Server</td>\n      <td>2106.0</td>\n      <td>12</td>\n      <td>6</td>\n      <td>AMD Opteron 4164 EE</td>\n      <td>1800</td>\n      <td>64 KB I + 64 KB D on chip per core</td>\n      <td>512 KB I+D on chip per core</td>\n      <td>6 MB I+D on chip per chip</td>\n      <td>16.0</td>\n      <td>Jul-2010</td>\n      <td>http://www.spec.org/power_ssj2008/results/res2...</td>\n    </tr>\n  </tbody>\n</table>\n<p>819 rows × 13 columns</p>\n</div>"
     },
     "execution_count": 110,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# power_ssj数据源，感兴趣的属性\n",
    "ods_power_ssj_col = [\"Hardware Vendor\t\", \"System\", \"Result\", \"# Cores\", \"# Cores Per Chip \", \"Processor \", \"Processor MHz\", \"1st Level Cache\", \"2nd Level Cache\", \"3rd Level Cache\", \"Memory (GB)\",\"Updated \", \"Disclosure\"]\n",
    "\n",
    "# 抽取相关属性，构成DataFrame，前缀为ods表明为贴源数据层（其中# cores per chip为中间数据，数据清洗完成后应当删去）\n",
    "ods_power_ssj_data = pd.read_csv(ods_jvm2008.get_latest_results(benchmark_name=\"power_ssj2008\"), usecols=ods_power_ssj_col)\n",
    "\n",
    "# 更新部分属性名\n",
    "ods_power_ssj_data = ods_power_ssj_data.rename(columns={\"Updated \": \"Updated\"})\n",
    "\n",
    "#去掉属性中的\\t\n",
    "#例Max-jOPS\\t修改为Max-jOPS\n",
    "ods_power_ssj_data.columns = [j.strip() for j in ods_power_ssj_data.columns.values.tolist()]\n",
    "ods_power_ssj_data"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "markdown",
   "source": [
    "## 2 抽取感兴趣的属性\n",
    "\n",
    "感兴趣的属性：\n",
    "- Hardware Vendor机器生产公司\n",
    "- System系统型号\n",
    "- Result得分\n",
    "- \\# cores核心数\n",
    "- Processor处理器型号【是统一的数据主体，合并数据时以该属性作为准则】\n",
    "- CPU频率\n",
    "- 各级Cache容量：Primary Cache, Secondary Cache, Tertiary Cache\n",
    "- Memory存储大小\n",
    "- Updated最后分数记录时间\n",
    "- Disclosure详细结果报告的链接"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%% md\n"
    }
   }
  },
  {
   "cell_type": "markdown",
   "source": [
    "## 3. 数据转换和清洗\n",
    "\n",
    "引入需要的库，后续对每一个属性的值，写出一个转换函数，即原始值X到转换后的值Y的函数，这个函数可以套用到DataFrame的map方法或者apply方法，用于批量操作"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%% md\n"
    }
   }
  },
  {
   "cell_type": "code",
   "source": [
    "import re\n",
    "from typing import Union"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   },
   "execution_count": 111,
   "outputs": []
  },
  {
   "cell_type": "markdown",
   "source": [
    "#### 1. Hardware Vendor属性\n",
    "\n",
    "1. 公司名称后缀的Inc. Co.,Ltd. LLC. Corp全部洗掉\n",
    "2. Uniwide Technologies和UNIWIDE Technologies的情况统一大小写"
   ],
   "metadata": {
    "collapsed": false
   }
  },
  {
   "cell_type": "code",
   "execution_count": 112,
   "outputs": [],
   "source": [
    "def company_rule(x: str) -> str:\n",
    "    \"\"\"\n",
    "    对Company这一列数据的处理操作，用于DataFrame的map方法\n",
    "    :param x: Hardware Vendor属性的值\n",
    "    :return: 处理后的值\n",
    "    \"\"\"\n",
    "    #去掉公司后缀\n",
    "    x = x.replace(\"Inc\", \"\")\n",
    "    x = x.replace(\"CO., LTD.\", \"\")\n",
    "    x = x.replace(\"Co., Ltd.\", \"\")\n",
    "    x = x.replace(\".\", \"\")\n",
    "    x = x.replace(\",\", \"\")\n",
    "    #统一命名\n",
    "    x = x.replace(\"Incoporated\", \"Incorporated\")\n",
    "    x = x.replace(\"Corp.\", \"Corporation\")\n",
    "    x = x.replace(\"Supermicro\", \"Super Micro Computer\")\n",
    "    x = x.replace(\"Hewlett-Packard\", \"Hewlett Packard\")\n",
    "\n",
    "    return x"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "markdown",
   "source": [
    "#### 2. System属性\n",
    "    例如\"ASUS RS100-E5 (Intel Xeon X3360 Processor, 2.83 GHz)\"去掉（）内的内容"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%% md\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 113,
   "outputs": [],
   "source": [
    "def system_rule(x:str) -> str:\n",
    "    y = re.sub(r\"\\(.*\\)\", \"\", x)    # 删除括号中的内容\n",
    "    return y"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "markdown",
   "source": [
    "#### 3. Result属性\n",
    "    删掉Result为0的测试结果"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%% md\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 114,
   "outputs": [],
   "source": [
    "def result_rule():\n",
    "    power_ssj[\"result\"]=power_ssj.drop(power_ssj.index[(power_ssj[\"Result\"] == 0)],inplace = True)"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "markdown",
   "source": [
    "#### 4. # core属性：不清洗\n",
    "#### 5.Processor属性\n",
    "- 例如\"AMD EPYC 7742 2.25Ghz\"应该删掉\"2.25Ghz\"\n",
    "- 例如\"Intel Xeon E5-2660 2.2 GHz (Intel Turbo Boost Technology up to 3.00 GHz)\"不仅要删掉频率，还需要删掉（）内的内容\n",
    "- 例如\"Intel(R) Xeon(R) E-2388G CPU 3.20GHz\"需要删掉\"CPU 3.20GHz\"，除此之外还需要将（R）删掉。和其他测试结果同步。\n",
    "- 例如\"Intel Xeon Gold 6314U CPU @ 2.30GHz (Intel Turbo Boost Technology up to 3.4GHz)\"，需要删掉\"CPU @ 2.30GHz (Intel Turbo Boost Technology up to 3.4GHz)\"\n",
    "- 除此之外，上述情况会有英文字母大小写的区分。\n",
    "- 例如\"Intel Xeon X3360\"和\"Intel Xeon X3360 Processor\"需要删掉processor字样。\n"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%% md\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 115,
   "outputs": [],
   "source": [
    "def processor_rule(x:str) -> str:\n",
    "    y = re.sub(r\"(CPU|[2|3][.]|@|,).*G[H|h]z\", \"\", x)\n",
    "    y = re.sub(r\"\\(.*\\)\", \"\", y)\n",
    "    y = y.replace(\"processor \", \"\")\n",
    "    #y = y.replace(\"processor \", \"\")\n",
    "    return y"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "markdown",
   "source": [
    "#### 6. Processor MHz属性：不清洗\n",
    "#### 7. Cache相关属性\n",
    "1. 1st Level Cachee属性，有2种情况：\n",
    "    1. \\[case 1\\] 分icache和dcache（例如”32KB I +32KB D on chip, per core“），那么应当整理为”XXKB(I)+XXKB(D)“，这里都是per core的大小（如果计算总大小，应当乘以core数量）\n",
    "       1. 正则表达式中还需要包括空格的情况，如例子\"32 KB (I) + 32 KB (D) on chip per core\"\n",
    "       2. 需要统一\"32 KB I+32 KB D per core\"和\"32KB(I)+32KB(D) per core\"中的（I）和（D）\n",
    "       3. \"384 KB I + 192 KB D on chip per chip\"应该除以cores_per_chip\n",
    "    2. \\[case 2\\] 不分icache和dcache（例如”32 KB“），那么应当整理为”XXKB(I+D)“。\n",
    "    3. \\[case 3\\] 例如\"12 K micro-ops + 16 KB D on chip per chip\"应该除以cores_per_chip\n",
    "2. 2nd Level Cache属性，这里都是per core的大小，有多种情况：\n",
    "    1. \\[case 1\\] 例如”512 KB I+D on chip per core“，出现了”per core“的，这里直接化为”512KB“即可。\n",
    "    2. \\[case 2\\] 例如”12 MB I+D on chip per chip, 2 MB shared / 2 cores“，用括号内的计算，得到1MB per core，最终化为”1024KB“\n",
    "    3. \\[case 3\\] 例如\"24 MB I+D on chip per chip\" 需要除以core per chip*1024作为最终结果\n",
    "    4. \\[case 4\\] 例如\"12 MB I+D on chip per chip, 6 MB shared / 2 cores\"需要将6MB除以core数然后*1024，统一为KB单位\n",
    "3. 3rd Level Cache属性，考虑到其他数据源既有Other Cache也有3rd Cache，这里应当予以区分，全部化为per chip\n",
    "   1. \\[case 1\\] 例如缺失值NaN，3rd Level Cache应当为0。\n",
    "   2. \\[case 2\\] 16 MB I+D on chip per chip, 8 MB shared / 8 cores应当8MB/8core最为最终结果。\n",
    "   3. \\[case 3\\] 例如“60 MB I+D on chip per chip”，提到了“per chip”，应当在3rd Level Cache记录为“12MB”。\n",
    "   4. \\[case 4\\] 例如\"64 MB I+D on chip per core\",应当64MB*cores_per_chip。"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%% md\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 116,
   "outputs": [],
   "source": [
    "def first_cache_rule(line: pd.Series) -> str:\n",
    "    x = line[\"1st Level Cache\"]\n",
    "    cores_per_chip = line[\"# Cores Per Chip\"]\n",
    "    #cores_num = line[\"# cores\"]\n",
    "    if x.find(\"per core\") != -1 & x.find(\"I+D\") == -1:\n",
    "        # 说明：(group1: 1个以上数字)+'KB'+可能有空格+'(I)'或'I'+可能有空格+'+'+可能有空格+(group2: 1个以上数字)+'KB'+可能有空格+'(D)'或'D'\n",
    "        search_obj = re.match(r\"(\\d+)\\s*KB\\s*(?:\\(I\\)|I|)\\s*\\+\\s*(\\d+)\\s*KB\\s*(?:\\(D\\)|D|)\", x)\n",
    "        l1i_kb = search_obj.group(1)\n",
    "        l1d_kb = search_obj.group(2)\n",
    "        return f\"{l1i_kb}KB(I)+{l1d_kb}KB(D)\"\n",
    "    elif x.find(\"I+D\") != -1:\n",
    "        # 说明：(group1: 1个以上数字)+可能有空格+'KB'\n",
    "        search_obj = re.match(r\"(\\d+)\\s*KB\", x)\n",
    "        l1_kb = search_obj.group(1)\n",
    "        return f\"{l1_kb}KB(I+D)\"\n",
    "    elif x.find(\"per chip\") != -1 & x.find(\"micro-ops\") == -1:\n",
    "        search_obj = re.match(r\"(\\d+)\\s*KB\\s*(?:\\(I\\)|I|)\\s*\\+\\s*(\\d+)\\s*KB\\s*(?:\\(D\\)|D|)\", x)\n",
    "        l1i_kb = round(int(search_obj.group(1))/cores_per_chip, 2)\n",
    "        l1d_kb = round(int(search_obj.group(2))/cores_per_chip, 2)\n",
    "        return f\"{l1i_kb}KB(I)+{l1d_kb}KB(D)\"\n",
    "    elif x.find(\"micro-ops\") != -1:\n",
    "        search_obj = re.match(r\"(\\d+)\\s*K\\s*micro-ops\\s*(?:\\(I\\)|I|)\\s*\\+\\s*(\\d+)\\s*KB\\s*(?:\\(D\\)|D|)\", x)\n",
    "        l1i_kb = round(int(search_obj.group(1))/cores_per_chip, 2)\n",
    "        l1d_kb = round(int(search_obj.group(2))/cores_per_chip, 2)\n",
    "        return f\"{l1i_kb}KB (I)+{l1d_kb}KB(D)\"\n",
    "def second_cache_rule(line: pd.Series) -> str:\n",
    "    \"\"\"\n",
    "    对2nd Cache这一列数据的处理操作，用于DataFrame的apply方法（需要用到其他属性的值）\n",
    "    :param line: DataFrame的一行，类型是pd.Series\n",
    "    :return: 处理后的2nd Cache per core(KB)值\n",
    "    \"\"\"\n",
    "    x = line[\"2nd Level Cache\"]\n",
    "    cores_per_chip = line[\"# Cores Per Chip\"]\n",
    "    #cores_num = line[\"# cores\"]\n",
    "    if x.find(\"per core\") != -1 or x.find(\"per dual core\") != -1:\n",
    "        if x.find(\"M\")+x.find(\"MB\")!= -2:\n",
    "            search_obj = re.match(r\"(\\d+(\\.\\d+)|\\d+)(\\s*|)(MB|M)\", x)\n",
    "            l2_kb = (int(search_obj.group(1)) * 1024)\n",
    "        else:\n",
    "            search_obj = re.match(r\"(\\d+(\\.\\d+)|\\d+)(\\s*|)KB\", x)\n",
    "            l2_kb = search_obj.group(1)\n",
    "        return f\"{l2_kb}KB\"\n",
    "    elif x.find(\"per chip\") != -1 or x.find(\"/ chip\") != -1 & x.find(\"shared\") == -1:\n",
    "        if x.find(\"M\")+x.find(\"MB\")!= -2:\n",
    "            search_obj = re.match(r\"(\\d+)\\s*MB\", x)\n",
    "            l2_kb = round((int(search_obj.group(1)) * 1024)/ cores_per_chip,2)\n",
    "        else:\n",
    "            search_obj = re.match(r\"(\\d+)\\s*KB\", x)\n",
    "            l2_kb = round(int(search_obj.group(1)) / cores_per_chip,2)\n",
    "\n",
    "        return f\"{l2_kb}KB\"\n",
    "    elif x.find(\"shared\") != -1:\n",
    "        search_obj = re.match(r\"(\\d+)(\\s*|)MB\", x)\n",
    "        l2_kb = round((int(search_obj.group(1)) * 1024) / 2, 2)\n",
    "        return f\"{l2_kb}KB\"\n",
    "def third_cache_rule(line: pd.Series) -> str:\n",
    "    x = line[\"3rd Level Cache\"]\n",
    "    cores_per_chip = line[\"# Cores Per Chip\"]\n",
    "    #cores_num = line[\"# cores\"]\n",
    "    if x.find(\"shared\") != -1 or x.find(\"shard\") != -1 or x.find(\"Shared\") != -1:\n",
    "        #search_obj = re.match(r\"((\\d+)|(\\d)(\\s*|)MB(\\s*|)(s|S)har(e|)d(\\s*|)\\/(\\s*|)(\\d)\", x)\n",
    "        #print(search_obj.group())\n",
    "        #print(search_obj.group(2))\n",
    "        #l3_gb = int(int(search_obj.group(1))/int(search_obj.group(2)))\n",
    "        pattern = re.compile(r'\\d+')\n",
    "        search_obj  = pattern.findall(x)\n",
    "        #print(search_obj)\n",
    "        #print(search_obj[1])\n",
    "        #print(search_obj[2])\n",
    "        l3_gb = round(int(search_obj[1])/int(search_obj[2]),2)\n",
    "        return f\"{l3_gb}MB\"\n",
    "\n",
    "    elif x.find(\"per chip\") != -1 & x.find(\"shared\") == -1:\n",
    "        if x.find(\"M\")+x.find(\"MB\")!= -2:\n",
    "            search_obj = re.match(r\"(\\d+)\\s*MB\", x)\n",
    "            l3_gb = int(search_obj.group(1))\n",
    "        else:\n",
    "            search_obj = re.match(r\"(\\d+)\\s*KB\", x)\n",
    "            l3_gb = round(int(search_obj.group(1))/1024, 2)\n",
    "        return f\"{l3_gb}MB\"\n",
    "    elif x.find(\"per core\") != -1:\n",
    "        search_obj = re.match(r\"(\\d+)\\s*MB\", x)\n",
    "        l3_gb = int(search_obj.group(1))*cores_per_chip\n",
    "        return f\"{l3_gb}MB\"\n",
    "    else:\n",
    "        return \"0\""
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "markdown",
   "source": [
    "#### 8.Memory存储大小\n",
    "- 例如1,000需要去掉\",\"和1000统一格式\n",
    "- 例如256.00需要修改为256"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%% md\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 117,
   "outputs": [],
   "source": [
    "def memory_rule(x:str) -> str:\n",
    "    if type(x)==str:\n",
    "        y = x.replace(\",\", \"\")\n",
    "        search_obj = re.match(r\"\\d+\", y)\n",
    "        resu = search_obj.group(0)\n",
    "        return resu\n",
    "    else:\n",
    "        y = int(x)\n",
    "        return y"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "markdown",
   "source": [
    "#### 9. Updated属性：不清洗\n",
    "#### 10. Disclosure属性：不清洗"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%% md\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 118,
   "outputs": [
    {
     "data": {
      "text/plain": "       Hardware Vendor                    System   Result  # Cores  \\\n0    ASUSTeK Computer             ASUS RS100-E5     905.0        4   \n1    ASUSTeK Computer             ASUS RS160-E5    1009.0        8   \n2    ASUSTeK Computer             ASUS RS160-E5    1020.0        8   \n3    ASUSTeK Computer             RS500A-E10-PS4  20908.0       64   \n4    ASUSTeK Computer             RS500A-E10-PS4  21168.0       64   \n..                 ...                       ...      ...      ...   \n814              XSLAB               V-Raptor SQ   3337.0      384   \n815         ZT Systems  1224Ra Datacenter Server   1379.0        8   \n816         ZT Systems  1224Ra Datacenter Server   1614.0       12   \n817         ZT Systems  1224Ra Datacenter Server   1532.0       12   \n818         ZT Systems  1253Ra Datacenter Server   2106.0       12   \n\n                                             Processor  Processor MHz  \\\n0                           Intel Xeon X3360 Processor           2833   \n1                                     Intel Xeon L5420           2500   \n2                                     Intel Xeon L5430           2666   \n3                                       AMD EPYC 7742            2250   \n4                                       AMD EPYC 7742            2250   \n..                                                 ...            ...   \n814  ARM Cortex A53 24 Cores: SOCIONEXT SC2A11 ARM SoC           1000   \n815                                AMD Opteron 2377 EE           2300   \n816                                AMD Opteron 2419 EE           1800   \n817                                AMD Opteron 2425 HE           2100   \n818                                AMD Opteron 4164 EE           1800   \n\n    1st cache per core(KB) 2nd cache per core(KB) 3rd cache per core(KB)  \\\n0          32KB(I)+32KB(D)               3072.0KB                      0   \n1          32KB(I)+32KB(D)               3072.0KB                      0   \n2          32KB(I)+32KB(D)               3072.0KB                      0   \n3          32KB(I)+32KB(D)                  512KB                  4.0MB   \n4          32KB(I)+32KB(D)                  512KB                  4.0MB   \n..                     ...                    ...                    ...   \n814        16KB(I)+16KB(D)                  256KB                    4MB   \n815        64KB(I)+64KB(D)                  512KB                    6MB   \n816        64KB(I)+64KB(D)                  512KB                    6MB   \n817        64KB(I)+64KB(D)                  512KB                    6MB   \n818        64KB(I)+64KB(D)                  512KB                    6MB   \n\n    Memory (GB)   Updated                                         Disclosure  \n0             4  Jul-2010  http://www.spec.org/power_ssj2008/results/res2...  \n1             8  Apr-2009  http://www.spec.org/power_ssj2008/results/res2...  \n2             8  Apr-2009  http://www.spec.org/power_ssj2008/results/res2...  \n3           128  Jan-2020  http://www.spec.org/power_ssj2008/results/res2...  \n4           128  Jan-2020  http://www.spec.org/power_ssj2008/results/res2...  \n..          ...       ...                                                ...  \n814         256  Dec-2021  http://www.spec.org/power_ssj2008/results/res2...  \n815          16  Jul-2010  http://www.spec.org/power_ssj2008/results/res2...  \n816           8  Aug-2009  http://www.spec.org/power_ssj2008/results/res2...  \n817          16  Aug-2009  http://www.spec.org/power_ssj2008/results/res2...  \n818          16  Jul-2010  http://www.spec.org/power_ssj2008/results/res2...  \n\n[819 rows x 12 columns]",
      "text/html": "<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n\n    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n\n    .dataframe thead th {\n        text-align: right;\n    }\n</style>\n<table border=\"1\" class=\"dataframe\">\n  <thead>\n    <tr style=\"text-align: right;\">\n      <th></th>\n      <th>Hardware Vendor</th>\n      <th>System</th>\n      <th>Result</th>\n      <th># Cores</th>\n      <th>Processor</th>\n      <th>Processor MHz</th>\n      <th>1st cache per core(KB)</th>\n      <th>2nd cache per core(KB)</th>\n      <th>3rd cache per core(KB)</th>\n      <th>Memory (GB)</th>\n      <th>Updated</th>\n      <th>Disclosure</th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <th>0</th>\n      <td>ASUSTeK Computer</td>\n      <td>ASUS RS100-E5</td>\n      <td>905.0</td>\n      <td>4</td>\n      <td>Intel Xeon X3360 Processor</td>\n      <td>2833</td>\n      <td>32KB(I)+32KB(D)</td>\n      <td>3072.0KB</td>\n      <td>0</td>\n      <td>4</td>\n      <td>Jul-2010</td>\n      <td>http://www.spec.org/power_ssj2008/results/res2...</td>\n    </tr>\n    <tr>\n      <th>1</th>\n      <td>ASUSTeK Computer</td>\n      <td>ASUS RS160-E5</td>\n      <td>1009.0</td>\n      <td>8</td>\n      <td>Intel Xeon L5420</td>\n      <td>2500</td>\n      <td>32KB(I)+32KB(D)</td>\n      <td>3072.0KB</td>\n      <td>0</td>\n      <td>8</td>\n      <td>Apr-2009</td>\n      <td>http://www.spec.org/power_ssj2008/results/res2...</td>\n    </tr>\n    <tr>\n      <th>2</th>\n      <td>ASUSTeK Computer</td>\n      <td>ASUS RS160-E5</td>\n      <td>1020.0</td>\n      <td>8</td>\n      <td>Intel Xeon L5430</td>\n      <td>2666</td>\n      <td>32KB(I)+32KB(D)</td>\n      <td>3072.0KB</td>\n      <td>0</td>\n      <td>8</td>\n      <td>Apr-2009</td>\n      <td>http://www.spec.org/power_ssj2008/results/res2...</td>\n    </tr>\n    <tr>\n      <th>3</th>\n      <td>ASUSTeK Computer</td>\n      <td>RS500A-E10-PS4</td>\n      <td>20908.0</td>\n      <td>64</td>\n      <td>AMD EPYC 7742</td>\n      <td>2250</td>\n      <td>32KB(I)+32KB(D)</td>\n      <td>512KB</td>\n      <td>4.0MB</td>\n      <td>128</td>\n      <td>Jan-2020</td>\n      <td>http://www.spec.org/power_ssj2008/results/res2...</td>\n    </tr>\n    <tr>\n      <th>4</th>\n      <td>ASUSTeK Computer</td>\n      <td>RS500A-E10-PS4</td>\n      <td>21168.0</td>\n      <td>64</td>\n      <td>AMD EPYC 7742</td>\n      <td>2250</td>\n      <td>32KB(I)+32KB(D)</td>\n      <td>512KB</td>\n      <td>4.0MB</td>\n      <td>128</td>\n      <td>Jan-2020</td>\n      <td>http://www.spec.org/power_ssj2008/results/res2...</td>\n    </tr>\n    <tr>\n      <th>...</th>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n    </tr>\n    <tr>\n      <th>814</th>\n      <td>XSLAB</td>\n      <td>V-Raptor SQ</td>\n      <td>3337.0</td>\n      <td>384</td>\n      <td>ARM Cortex A53 24 Cores: SOCIONEXT SC2A11 ARM SoC</td>\n      <td>1000</td>\n      <td>16KB(I)+16KB(D)</td>\n      <td>256KB</td>\n      <td>4MB</td>\n      <td>256</td>\n      <td>Dec-2021</td>\n      <td>http://www.spec.org/power_ssj2008/results/res2...</td>\n    </tr>\n    <tr>\n      <th>815</th>\n      <td>ZT Systems</td>\n      <td>1224Ra Datacenter Server</td>\n      <td>1379.0</td>\n      <td>8</td>\n      <td>AMD Opteron 2377 EE</td>\n      <td>2300</td>\n      <td>64KB(I)+64KB(D)</td>\n      <td>512KB</td>\n      <td>6MB</td>\n      <td>16</td>\n      <td>Jul-2010</td>\n      <td>http://www.spec.org/power_ssj2008/results/res2...</td>\n    </tr>\n    <tr>\n      <th>816</th>\n      <td>ZT Systems</td>\n      <td>1224Ra Datacenter Server</td>\n      <td>1614.0</td>\n      <td>12</td>\n      <td>AMD Opteron 2419 EE</td>\n      <td>1800</td>\n      <td>64KB(I)+64KB(D)</td>\n      <td>512KB</td>\n      <td>6MB</td>\n      <td>8</td>\n      <td>Aug-2009</td>\n      <td>http://www.spec.org/power_ssj2008/results/res2...</td>\n    </tr>\n    <tr>\n      <th>817</th>\n      <td>ZT Systems</td>\n      <td>1224Ra Datacenter Server</td>\n      <td>1532.0</td>\n      <td>12</td>\n      <td>AMD Opteron 2425 HE</td>\n      <td>2100</td>\n      <td>64KB(I)+64KB(D)</td>\n      <td>512KB</td>\n      <td>6MB</td>\n      <td>16</td>\n      <td>Aug-2009</td>\n      <td>http://www.spec.org/power_ssj2008/results/res2...</td>\n    </tr>\n    <tr>\n      <th>818</th>\n      <td>ZT Systems</td>\n      <td>1253Ra Datacenter Server</td>\n      <td>2106.0</td>\n      <td>12</td>\n      <td>AMD Opteron 4164 EE</td>\n      <td>1800</td>\n      <td>64KB(I)+64KB(D)</td>\n      <td>512KB</td>\n      <td>6MB</td>\n      <td>16</td>\n      <td>Jul-2010</td>\n      <td>http://www.spec.org/power_ssj2008/results/res2...</td>\n    </tr>\n  </tbody>\n</table>\n<p>819 rows × 12 columns</p>\n</div>"
     },
     "execution_count": 118,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "\n",
    "ods_power_ssj_data[\"Hardware Vendor\"] = ods_power_ssj_data[\"Hardware Vendor\"].map(company_rule)\n",
    "ods_power_ssj_data[\"System\"] = ods_power_ssj_data[\"System\"].map(system_rule)\n",
    "result_rule()\n",
    "ods_power_ssj_data[\"Processor\"] = ods_power_ssj_data[\"Processor\"].map(processor_rule)\n",
    "ods_power_ssj_data[\"1st cache per core(KB)\"] = ods_power_ssj_data.apply(first_cache_rule, axis=1)\n",
    "ods_power_ssj_data[\"2nd cache per core(KB)\"] = ods_power_ssj_data.apply(second_cache_rule, axis=1)\n",
    "ods_power_ssj_data[\"3rd cache per core(KB)\"] = ods_power_ssj_data.apply(third_cache_rule, axis=1)\n",
    "ods_power_ssj_data[\"Memory (GB)\"] = ods_power_ssj_data[\"Memory (GB)\"].map(memory_rule)\n",
    "\n",
    "ods_power_ssj_data = ods_power_ssj_data.drop(columns=[\"# Cores Per Chip\", \"1st Level Cache\", \"2nd Level Cache\", \"3rd Level Cache\"])\n",
    "\n",
    "ods_order = [\"Hardware Vendor\", \"System\", \"Result\", \"# Cores\", \"Processor\", \"Processor MHz\", \"1st cache per core(KB)\", \"2nd cache per core(KB)\", \"3rd cache per core(KB)\", \"Memory (GB)\", \"Updated\",\"Disclosure\"]\n",
    "\n",
    "\n",
    "ods_power_ssj_data = ods_power_ssj_data[ods_order]\n",
    "ods_power_ssj_data"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}